#include "precompiled.h"
#include "Texture.h"

PFNGLACTIVETEXTUREPROC *classptr_Texture_glActiveTexture = NULL;
PFNGLUNIFORM1IARBPROC  *classptr_Texture_glUniform1iARB	= NULL;

void Texture::set_ptrGlActiveTexture( PFNGLACTIVETEXTUREPROC *f ){
	classptr_Texture_glActiveTexture = f;
}

void Texture::set_ptrglUniform1i( PFNGLUNIFORM1IARBPROC* f){
	classptr_Texture_glUniform1iARB = f;
}

Texture::Texture(void)
{
}


Texture::~Texture(void)
{
}


Texture::Texture( GLuint texID)
{
	_texID=texID;
}

void Texture::set_texID(GLuint id){
	_texID=id;
}
void Texture::Bind(GLint tex_index, GLint uniform_location){
	_currentIndex = tex_index;
	glEnable(GL_TEXTURE_2D);
	(*classptr_Texture_glActiveTexture)( GL_TEXTURE0_ARB + _currentIndex );
	(*classptr_Texture_glUniform1iARB)(uniform_location, _currentIndex);
	glBindTexture( GL_TEXTURE_2D, _texID );
}
void Texture::Unbind(){
	(*classptr_Texture_glActiveTexture)( GL_TEXTURE0_ARB + _currentIndex );
	glBindTexture( GL_TEXTURE_2D, 0 );
}
